cmake_minimum_required(VERSION 3.0.2)
project(relocalizationCensiICP)

## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msgs
)

## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)

include_directories(include)


FIND_PACKAGE(GSL REQUIRED)
IF(GSL_FOUND)
    MESSAGE(STATUS "Found GSL:")
    MESSAGE(STATUS "   GSL_LIBRARIES = ${GSL_LIBRARIES}")
    MESSAGE(STATUS "   GSL_INCLUDE_DIR = ${GSL_INCLUDE_DIR}")
    MESSAGE(STATUS "   CMAKE_GSL_CXX_FLAGS = ${CMAKE_GSL_CXX_FLAGS}")
    MESSAGE(STATUS "   GSL_LINK_DIRECTORIES = '${GSL_LINK_DIRECTORIES}'")


    set(icp_c_flags "${icp_c_flags} -I${GSL_INCLUDE_DIR}")
    if(GSL_LINK_DIRECTORIES)
        set(icp_link_flags "${icp_link_flags} -L${GSL_LINK_DIRECTORIES}")
    endif(GSL_LINK_DIRECTORIES)

    set(icp_link_flags "${icp_link_flags} ${GSL_LIBRARIES}")

ELSE(GSL_FOUND)
    MESSAGE(FATAL_ERROR "GSL not found.")
ENDIF(GSL_FOUND)

find_package (Eigen3 REQUIRED)

include_directories("/usr/include/eigen3")

SET(requiredlibs)

find_package(PkgConfig REQUIRED)
pkg_check_modules(YAMLCPP yaml-cpp REQUIRED)
if(YAMLCPP_VERSION VERSION_GREATER "0.5.0")
    add_definitions(-DHAVE_YAMLCPP_GT_0_5_0)
endif()
link_directories(${YAMLCPP_LIBRARY_DIRS})


catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES navigation
#  CATKIN_DEPENDS roscpp rospy std_msgs
#  DEPENDS system_lib
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
# include
  ${catkin_INCLUDE_DIRS}
  )


aux_source_directory(src CORESRC_LIST)
add_subdirectory(src)



#add execute file
add_executable(relocalizationCensiICP navigationnode.cpp)

# add execute lib
target_link_libraries(relocalizationCensiICP
  csm
  ${GSL_LIBRARIES}
  ${catkin_LIBRARIES}
  ${YAMLCPP_LIBRARIES}  
  )
